<?php $header=$this->action('ZfcAdmin\Controller\AdminController', 'headerAction');
	  $baseUrl = $header->headerarray['baseUrl'];
?>
<?php if(isset($_SESSION['admin'])){?>
<center>
		<div>
			<div>
				<div><h1>Edit Form</h1></div>				
				<form id="edit_form" name="edit_form" method="post">
					<div>
						User Name:
						<input type="text" id="inputUserName" name="inputUserName" 
						value="<? if(isset($this->userdetails->user_name) && $this->userdetails->user_name!=""){echo $this->userdetails->user_name;
						}else{}?>" placeholder="Please Enter UserName" size="30">
					</div>
					</br>
					<div>
						Display Name:
						<input type="text" id="displayName" name="displayName" placeholder="Please display name" size="30" 
						value="<? if(isset($this->userdetails->display_name) && $this->userdetails->display_name!=""){echo $this->userdetails->display_name;
						}else{}?>">
					</div>
					</br>
					<div>
						Email Id:
						<input type="text" id="inputEmail" name="inputEmail" readonly="readonly" placeholder="Please Enter Email Id" size="30"
						value="<? if(isset($this->userdetails->email) && $this->userdetails->email!=""){echo $this->userdetails->email;
						}else{}?>">
					</div>
					</br>
					<div>
						Secondary Email:
					<input type="text" id="secondEmail" name="secondEmail" placeholder="Please Secondary Email" size="30"
					value="<? if(isset($this->userdetails->secondary_email) && $this->userdetails->secondary_email!=""){echo $this->userdetails->secondary_email;
						}else{}?>">
					</div>
					</br>
					<div>
						Phone Number:
					<input type="text" id="phoneNumber" name="phoneNumber" placeholder="Please Enter PhoneNumber" size="30"
					value="<? if(isset($this->userdetails->phone_number) && $this->userdetails->phone_number!=""){echo $this->userdetails->phone_number;
						}else{}?>">
					</div><br/>
					<div>
						Alternate Number:
					<input type="text" id="alternateNumber" name="alternateNumber" 
					placeholder="Please Enter AlternatePhoneNumber" size="30"
					value="<? if(isset($this->userdetails->alter_phone_mobile) && $this->userdetails->alter_phone_mobile!=""){echo $this->userdetails->alter_phone_mobile;
						}else{}?>">
					</div><br/>						
					<div>
						City Name:
						<input type="text" id="cityname" name="cityname" value="<? if(isset($this->userdetails->city_name) && $this->userdetails->city_name!=""){echo $this->userdetails->city_name;
						}else{}?>" placeholder="Please enter city name">
					</div>
					</br>
					<div>
						Address:<textarea  id="address" name="address" placeholder="Please Enter Address"><? if(isset($this->userdetails->address) && $this->userdetails->address!=""){echo $this->userdetails->address;
						}else{}?></textarea>
					</div>
					<br/>
					<div>
						PinCode:<input type="text" id="pincode" name="pincode" placeholder="PinCode" size="30" 
						value="<? if(isset($this->userdetails->pincode) && $this->userdetails->pincode!=""){echo $this->userdetails->pincode;
						}else{}?>">
					</div><br/>
					<?php if($this->userdetails->user_type=='franchisee'){?>
					<div id="franchesediv">
						<div>
							District:
									<select id="districts" name="districts" onChange="return getDistrictAreas('admin_dist_areas','final');">
											<option value="">select a district</option>
											<? if($this->alldistricts->count()>0){ foreach($this->alldistricts as $district){ 
											if($this->userdetails->district_id==$district->district_id){?>
											<option value="<? echo $district->district_id;?>" selected="selected"><? echo $district->district_name;?></option>
											<?}else {?>
											<option value="<? echo $district->district_id;?>"><? echo $district->district_name;?></option>
											<?}?>
											<?}}else{?>
											<option value="">No districts</option>
											<?}?>
									</select>
						</div>
						<br/>
						<div>
							Area:
								<select id="areas" name="areas" onChange="return getAreaBasedLocations('admin_area_locations')">
									<option value="">select a area</option>	
									<? if($this->areasAll->count()>0){ foreach($this->areasAll as $areas){ 
									if($this->userdetails->area_id==$areas->area_id){?>
									<option value="<? echo $areas->area_id;?>" selected="selected"><? echo $areas->area_name;?></option>
									<?}else{?>
									<option value="<? echo $areas->area_id;?>"><? echo $areas->area_name;?></option>
									<?}?>
									<?}}else{?>
									<option value="">No areas</option>
									<?}?>
								</select>	
						</div>
						<br/>
						<div>
							Location:
									<select id="location_id" name="location_id" >
										<option value="">select location</option>
										<? if($this->locationsAll->count()>0){ foreach($this->locationsAll as $locations){ 
										if($this->userdetails->location_id==$locations->location_id){?>
										<option value="<? echo $locations->location_id;?>" selected="selected"><? echo $locations->location_name;?></option>
										<?}else{?>
										<option value="<? echo $locations->location_id;?>"><? echo $locations->location_name;?></option>
										<?}?>
										<?}}else{?>
										<option value="">No locations</option>
										<?}?>
									</select>
						</div>
						<br/>
					</div>
					<?}?>
					<div class="controls">
						<button type="button" onClick="return edituserValidations('admin')">Save</button>&nbsp;&nbsp;&nbsp;<a  href="<? echo $baseUrl.'admin/user-lists'?>">Back</a>
						</div>
					<input type="hidden" id="hid_user_id" name="hid_user_id" 
					value="<? if(isset($this->userdetails->user_id) && $this->userdetails->user_id!=""){echo $this->userdetails->user_id;
						}else{}?>">
					<input type="hidden" id="hid_user_details_id" name="hid_user_details_id" 
					value="<? if(isset($this->userdetails->user_details_id) && $this->userdetails->user_details_id!=""){echo $this->userdetails->user_details_id;
						}else{}?>">
				</form>
			</div>
		</div>
	</center>
<?}else{?>
<script>
	window.location=ADMIN_BASE_URL+'admin';
</script>
<?}?>